home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
223_01
/
ualloc.c
< prev
next >
Wrap
Text File
|
1980-01-01
|
768b
|
28 lines
/*
** ------------ Memory Allocation
*/
/*
** Allocate n bytes of (possibly zeroed) memory.
** Entry: n = Size of the items in bytes.
** clear = "true" if clearing is desired.
** Returns the address of the allocated block of memory
** or NULL if the requested amount of space is not available.
*/
#include <stdio.h>
extern char *zzmem;
static char *oldptr;
Ualloc(n, clear) char *n; int clear; {
if(n < avail(YES)) {
if(clear) pad(zzmem, NULL, n);
oldptr = zzmem;
zzmem += n;
return (oldptr);
}
return (NULL);
}